<template>
	<view class="page">
		<view style="color: #fff;font-size: 36rpx;margin-left: 40rpx;margin-top: 60rpx;">HI~欢迎来到疫苗通</view>
		<view style="color: #fff;font-size: 32rpx;margin-left: 60rpx;margin-top: 30rpx;">遇到问题帮您解决，专属服务接种更简单</view>
		<view class="login-box">
			<u--form labelPosition="left" :model="form">
				<u-form-item label="账号:" prop="form.user" borderBottom>
					<u--input placeholder="请输入账号" v-model="form.user" border="none"></u--input>
				</u-form-item>
				<u-form-item label="密码:" prop="form.password" borderBottom>
					<u--input placeholder="请输入密码" v-model="form.password" border="none"></u--input>
				</u-form-item>
			</u--form>
		</view>
		<view class="login" @click="loginBtn">
			立即登录
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					user: '',
					password: ''
				}
			}
		},
		methods: {
			// 登录成功后将数据存入缓存并返回
			loginBtn() {
				//判断是否填写
				if (!this.form.user) {
					this.$refs.uToast.show({message:'请输入账号'})
					return
				}
				if (!this.form.password) {
					this.$refs.uToast.show({message:'请输入密码'})
					return
				}
				// 调用登录接口 模拟
				uni.setStorageSync('user', 1)
				uni.navigateBack({
					delta: 2
				});
			}
		}
	}
</script>

<style scoped>
	.page {
		width: 100%;
		height: 95vh;
		background: -webkit-linear-gradient(#6B83FF, 40%, #B1BEFF, 70%, #E3E8FF);
		/* Safari 5.1 - 6.0 */
		background: -o-linear-gradient(#6B83FF, 40%, #B1BEFF, 70%, #E3E8FF);
		/* Opera 11.1 - 12.0 */
		background: -moz-linear-gradient(#6B83FF, 40%, #B1BEFF, 70%, #E3E8FF);
		/* Firefox 3.6 - 15 */
		background: linear-gradient(#6B83FF, 40%, #B1BEFF, 70%, #E3E8FF);
		overflow: hidden;
	}

	.login-box {
		width: 90%;
		height: 220rpx;
		background-color: #fff;
		border-radius: 16rpx;
		margin: 0 auto;
		margin-top: 180rpx;
		padding: 30rpx;
		box-sizing: border-box;
	}

	.login {
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		font-size: 36rpx;
		border-radius: 40rpx;
		width: 400rpx;
		height: 90rpx;
		background-color: #6B83FF;
		margin: 0 auto;
		margin-top: 160rpx;
	}
</style>
